#pragma GCC optimize(2)
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>

using namespace std;
using LL = long long;
const int N = 1e6 + 10, M = 26;
const LL INF = 1e18;

int n, m;
int d[N], k[M];
int q[N];
LL dp[N];



int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n;
    for(int i = 1; i <= n; i ++) cin >> d[i];
    cin >> m;
    for(int i = 1; i <= m; i ++) cin >> k[i];


    for(int i = 1; i <= m; i ++){
        int hh = 0, tt = -1;
        for(int j = 1; j <= n; j ++){
            if(hh <= tt && q[hh] < j - k[i]) hh++;

            if(j == 1){
                dp[j] = 0;
            }else{
                dp[j] = dp[q[hh]] + (d[q[hh]] > d[j] ? 0 : 1);
            }

            
            while(hh <= tt && (dp[q[tt]] > dp[j] ||((dp[q[tt]] == dp[j]) && (d[q[tt]] <= d[j])))) tt--;
            q[++tt] = j; 
        }

        cout << dp[n] << '\n';
    }




    return 0;
}